<?php
/**
 * Zead
 *
 * LICENSE	
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.opensource.org/licenses/bsd-license.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to eu@marcelomx.com so we can send you a copy immediately.
 *
 * @category   Zead
 * @author     Marcelo Rodrigues Gonzaga <eu@marcelomx.com>
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga
 * @link       http://code.google.com/p/zead 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License
 *
 **/


/** @see Zead_Manifest **/
require_once 'Zead/Manifest.php';

/**
 * Class Zead_Manifest_Adapter_Ini
 *
 * @category   Zead   Zead
 * @package    Zead_Manifest
 * @subpackage Zead_Manifest_Adapter
 * @copyright  Copyright (c) 2008 Marcelo Rodrigues Gonzaga 
 * @license    http://www.opensource.org/licenses/bsd-license.php     New BSD License    
 */
class Zead_Manifest_Adapter_Ini extends Zead_Manifest
{
	/**
	 * Setup and process the manifest data from an INI file
	 * @param array $config
	 */	
	protected function _setup(array $config = array())
	{
		// @TODO To be implements
		require_once 'Zend/Config/Ini.php';
		
		// Retrieve the ini
		$manifest = new Zend_Config_Ini($config['filename']);
		
		// Retrieve contents
		if ($manifest->contents) {
			// Set title
			
			$this->_manifest->setTitle($manifest->contents->title);
			
			foreach ($manifest->contents->content as $name => $content) {
				$element = $this->_manifest->addContent($name, $content->title);
				
				if ($content->content) {
					foreach ($content->content as $sname => $scontent) {
						$element->addContent($sname, $scontent->title);
					}
				}
				
			}
		}
		
		// Retrieve options
		if ($manifest->options) {
		}
	}
	

}
